package Month07.day28;

import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

public class DemoMapTest {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("yuank,23");
        list.add("yangz,24");
        list.add("yuwenq,24");
        list.add("litianl,24");
        Map<String, String> map = list.stream().filter(s -> {
                    String[] split = s.split(",");
                    int age = Integer.parseInt(split[1]);
                    return age < 24;
                }
        ).collect(Collectors.toMap((String s) -> {
                    return s.split(",")[0];
                }, (String s) -> {
                    return s.split(",")[1];
                }
        ));
        System.out.println(map);
    }
}
